---
title: Agent Integration
description: "Setup guides for some popular coding agents."
icon: robot
---

Container Use works with any coding agent that supports the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction).

<Note>All agents use the same MCP server command: `container-use stdio`</Note>

<details>
<summary>💡 Command Shortcut</summary>

The `container-use` command is also available as `cu` for convenience. Both commands work identically:
- `container-use stdio` (used in documentation)
- `cu stdio` (shortcut)

</details>

## Claude Code

**Add MCP Configuration:**
```sh
cd /path/to/repository
claude mcp add container-use -- container-use stdio
```

**Add Agent Rules (Optional):**
Save the CLAUDE.md file at the root of your repository:
```sh
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CLAUDE.md
```

**Trust Only Container Use Tools (Optional):**
For maximum security, restrict Claude Code to only use Container Use tools:
```sh
claude --allowedTools mcp__container-use__environment_add_service,mcp__container-use__environment_checkpoint,mcp__container-use__environment_config,mcp__container-use__environment_create,mcp__container-use__environment_file_delete,mcp__container-use__environment_file_edit,mcp__container-use__environment_file_list,mcp__container-use__environment_file_read,mcp__container-use__environment_file_write,mcp__container-use__environment_open,mcp__container-use__environment_run_cmd,mcp__container-use__environment_update_metadata
```

<Info>
  Learn more: [Claude Code MCP Documentation](https://docs.anthropic.com/en/docs/claude-code/tutorials#set-up-model-context-protocol-mcp)
</Info>

## Amazon Q Developer

**Add MCP Configuration:**
Add this configuration to `~/.aws/amazonq/mcp.json`:
```json
{
  "mcpServers": {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"],
      "env": {},
      "timeout": 60000
    }
  }
}
```

**Add Agent Rules:**
Save agent instructions to your project root:
```sh
mkdir -p ./.amazonq/rules && curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md > .amazonq/rules/container-use.md
```

**Trust Only Container Use Tools (Optional):**
```sh
q chat --trust-tools=container_use___environment_add_service,container_use___environment_checkpoint,container_use___environment_config,container_use___environment_create,container_use___environment_file_delete,container_use___environment_file_edit,container_use___environment_file_list,container_use___environment_file_read,container_use___environment_file_write,container_use___environment_open,container_use___environment_run_cmd,container_use___environment_update_metadata
```

<Card title="Video Tutorial" icon="youtube" href="https://youtu.be/C2g3vdbffOI">
  Watch the Amazon Q Developer setup walkthrough
</Card>

## Cursor

**Install MCP Server:**

Use the one-click deeplink to install (requires Cursor and Container Use already installed):

[![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/install-mcp?name=container-use&config=eyJjb21tYW5kIjoiY29udGFpbmVyLXVzZSBzdGRpbyJ9)

**Add Agent Rules:**

Add the rules file to your project or home directory:

```sh
curl --create-dirs -o .cursor/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/cursor.mdc
```

<Info>
  Learn more: [Cursor MCP
  Documentation](https://docs.cursor.com/context/model-context-protocol)
</Info>

## Windsurf

**Install MCP Server:**

In `~/.codeium/windsurf/mcp_config.json`, add the following configuration:

```json
{
  "mcpServers": {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"],
      "env": {}
    }
  }
}
```

**Add Agent Rules:**

Add the rules file to your project or home directory:

```sh
curl --create-dirs -o .windsurf/rules/container-use.mdc https://raw.githubusercontent.com/dagger/container-use/main/rules/windsurf.mdc
```

## VSCode / GitHub Copilot

**Configure MCP Server:**

Update your VSCode settings with:

```json
"mcp": {
  "servers": {
    "container-use": {
      "type": "stdio",
      "command": "container-use",
      "args": ["stdio"]
    }
  }
}
```

**Add Copilot Instructions (Optional):**

```sh
curl --create-dirs -o .github/copilot-instructions.md https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
```

<Card title="Video Tutorial" icon="youtube" href="https://youtu.be/Nz2sOef0gW0">
  Watch the VSCode setup walkthrough
</Card>

<Info>
  Learn more: [VSCode
  MCP](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) | [GitHub
  Copilot
  MCP](https://docs.github.com/en/copilot/customizing-copilot/extending-copilot-chat-with-mcp)
</Info>

## [Zed](https://zed.dev/)

First add the agent rules file, either as `.rules` in the root of your project or as one of the [other acceptable files/locations](https://zed.dev/docs/ai/rules?highlight=agent.md#rules-files).

```sh
curl -o .rules https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
```

Then, choose one of the methods to add the Container Use MCP server in Zed:

1. **Extension**: Visit the [Container Use extension page](https://zed.dev/extensions/container-use-mcp-server), open it in Zed, and hit install. Then, follow the configuration instructions that will appear on the modal.
2. **Settings**: Add the following snippet on your `settings.json`:

```json
"context_servers": {
  "container-use": {
    "source": "custom",
    "command": "container-use",
    "args": ["stdio"],
    "env": {}
  },
}
```

**Add Container Use Agent Profile (Optional):**

To lock the Zed agent out of your host system, you can create a dedicated agent profile that only enables Container Use tools. Add this to your `settings.json` under the `agent` section:

```json
"agent": {
  "profiles": {
    "container-use": {
      "name": "Container Use",
      "tools": {
        "fetch": true,
        "thinking": true,
        "copy_path": false,
        "find_path": false,
        "delete_path": false,
        "create_directory": false,
        "list_directory": false,
        "diagnostics": false,
        "read_file": false,
        "open": false,
        "move_path": false,
        "grep": false,
        "edit_file": false,
        "terminal": false
      },
      "enable_all_context_servers": false,
      "context_servers": {
        "container-use": {
          "tools": {
            "environment_add_service": true,
            "environment_checkpoint": true,
            "environment_config": true,
            "environment_create": true,
            "environment_file_delete": true,
            "environment_file_edit": true,
            "environment_file_list": true,
            "environment_file_read": true,
            "environment_file_write": true,
            "environment_open": true,
            "environment_run_cmd": true,
            "environment_update_metadata": true
          }
        }
      }
    }
  }
}
```

This profile ensures your agent can only use Container Use tools, preventing it from modifying your local files directly.

Next open the Zed Agent Panel ✨ in the lower right, select the "Container Use" profile from the dropdown to the left of the model dropdown, and prompt away!

## OpenCode

Configure the Container Use MCP server in a `opencode.json` file.

Configure the Container Use MCP server:

```json
{
  "$schema": "http://opencode.ai/config.json",
  "mcp": {
    "container-use": {
      "type": "local",
      "command": ["container-use", "stdio"],
      "enabled": true
    }
  }
}
```

Add the `AGENTS.md` file using this command (this is optional but usually provides the best results):

```sh
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> AGENTS.md
```

Run `opencode` and dispatch your agents to complete your tasks!

## Goose

**Method 1: Configuration File:**

Add to `~/.config/goose/config.yaml`:

```yaml
extensions:
  container-use:
    name: container-use
    type: stdio
    enabled: true
    cmd: container-use
    args:
      - stdio
    envs: {}
```

**Method 2: Interactive Setup:**

```sh
goose configure
```

Then add a command line extension with `container-use stdio` as the command.

**Method 3: Goose Desktop:**

Paste this URL into your browser:

```
goose://extension?cmd=container-use&arg=stdio&id=container-use&name=container%20use&description=use%20containers%20with%20dagger%20and%20git%20for%20isolated%20environments
```

<Info>
  Learn more: [Goose MCP
  Extensions](https://block.github.io/goose/docs/getting-started/using-extensions#mcp-servers)
</Info>

## Sourcegraph Amp

**Add MCP Configuration:**
Add this configuration to `~/.config/amp/settings.json`:
```json
{
    "amp.mcpServers": {
        "container-use": {
            "command": "container-use",
            "args": ["stdio"]
        }
    },
    "amp.permissions": [
      {"tool": "mcp__container-use__*", "action": "allow"}
    ],
    "amp.dangerouslyAllowAll": false,
    "amp.updates.autoUpdate.enabled": true
}
```

**Add Agent Rules:**
Save agent instructions to your project root:
```sh
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> AGENT.md
```

<Info>Learn more: [Sourcegraph Amp Documentation](https://ampcode.com/manual/)</Info>

## Charm Crush

**Add MCP Configuration:**
Add this configuration to [a valid location](https://github.com/charmbracelet/crush?tab=readme-ov-file#configuration) like `./.crush.json`:
```json
{
  "$schema": "https://charm.land/crush.json",
  "mcp": {
    "container-use": {
      "type": "stdio",
      "command": "container-use",
      "args": ["stdio"],
      "env": {}
    }
  },
  "permissions": {
    "allowed_tools": [
      "mcp_container-use_environment_add_service",
      "mcp_container-use_environment_checkpoint",
      "mcp_container-use_environment_config",
      "mcp_container-use_environment_create",
      "mcp_container-use_environment_file_delete",
      "mcp_container-use_environment_file_edit",
      "mcp_container-use_environment_file_list",
      "mcp_container-use_environment_file_read",
      "mcp_container-use_environment_file_write",
      "mcp_container-use_environment_open",
      "mcp_container-use_environment_run_cmd",
      "mcp_container-use_environment_update_metadata"
    ]
  }
}
```

**Add Agent Rules:**
Save agent instructions to your project root:
```sh
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> CRUSH.md
```

<Info>Learn more: [Crush project on GitHub](https://github.com/charmbracelet/crush)</Info>


## Cline

**Add MCP Configuration:**

Add to your Cline MCP server configuration JSON:

```json
{
  "mcpServers": {
    "container-use": {
      "disabled": false,
      "timeout": 60000,
      "type": "stdio",
      "command": "container-use",
      "args": ["stdio"],
      "env": {},
      "autoApprove": []
    }
  }
}
```

**Add Agent Rules:**

```sh
curl --create-dirs -o .clinerules/container-use.md https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md
```

<Info>Learn more: [Cline Documentation](https://cline.bot/)</Info>

## Qodo Gen

**Setup Steps:**

1. Open Qodo Gen chat panel in VSCode or IntelliJ
2. Click "Connect more tools"
3. Click "+ Add new MCP"
4. Add this configuration:

```json
{
  "mcpServers": {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"]
    }
  }
}
```

<Info>
  Learn more: [Qodo Gen MCP
  Documentation](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps)
</Info>

## Kilo Code

**Add MCP Configuration:**

Add at global or project level:

```json
{
  "mcpServers": {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"],
      "env": {},
      "alwaysAllow": [],
      "disabled": false
    }
  }
}
```

<Info>
  Kilo Code allows setting MCP servers at the global or project level. Learn
  more: [Kilo Code MCP
  Documentation](https://kilocode.ai/docs/features/mcp/using-mcp-in-kilo-code)
</Info>

## Kiro

**Add MCP Configuration:**

Add to `.kiro/settings/mcp.json` in your project root:

```json
{
  "mcpServers": {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"],
      "env": {},
      "disabled": false,
      "autoApprove": {}
    }
  }
}
```

**Add Steering Rules:**

Create `.kiro/steering/container-use.md`:

```markdown
---
inclusion: always
---

ALWAYS use ONLY Environments for ANY and ALL file, code, or shell operations—NO EXCEPTIONS—even for simple or generic requests.

DO NOT install or use the git cli with the environment_run_cmd tool. All environment tools will handle git operations for you. Changing ".git" yourself will compromise the integrity of your environment.

You MUST inform the user how to view your work using `container-use log <env_id>` and `container-use checkout <env_id>`. Failure to do this will make your work inaccessible to others.
```

## OpenAI Codex

**Add MCP Configuration:**

Add to `~/.codex/config.toml`:

```toml
[mcp_servers.container-use]
command = "container-use"
args = ["stdio"]
env = {}
```

**Add Agent Rules (Optional):**
Instruct Codex to use container-use for all projects:

```sh
mkdir -p ~/.codex
curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> ~/.codex/AGENTS.md
```

<Info>
  Learn more: [OpenAI Codex
  Documentation](https://github.com/openai/codex/tree/main/codex-rs)
</Info>

## Warp

**Add MCP Configuration:**

In the Warp sidebar, under Personal → MCP Servers → New:

```json
{
  "container-use": {
    "command": "container-use",
    "args": ["stdio"],
    "env": {},
    "working_directory": null,
    "start_on_launch": true
  }
}
```

<Info>Warp 2.0 introduces coding agents with MCP support.</Info>

## Gemini CLI

**Add MCP Configuration:**

Add to `~/.gemini/settings.json` or `.gemini/settings.json`:

```json
{
  "coreTools": [],
  "mcpServers": {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"],
      "timeout": 60000,
      "trust": true
    }
  }
}
```

<Info>
  Learn more: [Gemini CLI
  Configuration](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md)
</Info>

## JetBrains Junie

**Add MCP Configuration:**

Add or edit the MCP configuration in Settings under Tools → Junie → MCP Settings, or edit `~/.junie/mcp/mcp.json`:

```json
{
  "mcpServers":
  {
    "container-use": {
      "command": "container-use",
      "args": ["stdio"],
      "env": {},
      "timeout": 60000
    }
  }
}
```

<Info>
    MCP support in Beta starting with Junie plugin `2xx.204.xx`
</Info>

**Add Agent Rules:**

Save agent instructions to your project root:

```sh
mkdir -p ./.junie && curl https://raw.githubusercontent.com/dagger/container-use/main/rules/agent.md >> .junie/guidelines.md
```

<Info>
    Learn more: [Junie Guidelines](https://www.jetbrains.com/help/junie/customize-guidelines.html)
</Info>

**Trust MCP Tools (Optional):**

In the settings, under Tools → Junie → Action Allowlist: add _MCP Rule_.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Agent doesn't recognize Container Use">
    - Verify the `container-use` command is in your PATH: `which container-use`
    - Check MCP configuration syntax
    - Restart your agent after configuration changes
  </Accordion>

{" "}

<Accordion title="Permission errors">
  - Ensure Docker is running and accessible - Check file permissions for
  configuration files - Verify `container-use stdio` command works: `echo '{}' | container-use stdio`
</Accordion>

  <Accordion title="Tools not appearing">
    - Some agents require explicit tool trust/approval
    - Check your agent's MCP server logs
    - Verify Container Use tools are enabled in agent settings
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Back to Quickstart" icon="rocket" href="/quickstart">
    Return to the quickstart guide to create your first environment
  </Card>
  <Card
    title="Join Community"
    icon="discord"
    href="https://container-use.com/discord"
  >
    Get help and share experiences in #container-use
  </Card>
</CardGroup>
